{% extends "../layouts/admin.html" %} {% block content %}
<header class="header navbar bg-white shadow">
	<div class="btn-group tool-button">
		<a class="btn btn-primary navbar-btn" href="/taoke/order/index" data-pjax id="goback"><i class="ti-angle-left"></i> 订单管理</a>
	</div>
</header>

<div class="content-wrap">
	<div class="wrapper" style="min-height:500px;">
		<section class="panel panel-form">
			<form id="addForm" role="form" class="form-horizontal parsley-form" data-parsley-validate action="/taoke/setup/index" method="post">

				<div class="row mb10">
					<div class="col-lg-12">

						{% for item in setup %}

						<div class="form-group">
							<label for="{{item.code}}" class="col-sm-2 control-label">{{item.name}}</label>

							<div class="col-sm-8">
								{% if item.type == 0 %}

								<textarea id="{{item.code}}" class="form-control" name="{{item.code}}" data-parsley-required="true" placeholder="{{item.name}}">{{item.value}}</textarea> {% elif item.type == 3 %}

								<input id="{{item.code}}" type="number" class="form-control" name="{{item.code}}" data-parsley-required="true" placeholder="{{item.name}}" value="{{item.value}}"> {% elif item.type == 1 %}

								<textarea id="{{item.code}}" class="form-control" name="{{item.code}}" data-parsley-required="true" placeholder="{{item.name}}">{{item.value}}</textarea> {% elif item.type == 2 %}

								<select class="form-control" name="{{item.code}}">

									{% for idx,itm in item.extra %} {% if item.value == idx %}
									<option value="{{idx}}" selected>{{itm}}</option>
									{% else %}
									<option value="{{idx}}">{{itm}}</option>
									{% endif %} {% endfor %}
								</select>

								{% endif %}
							</div>
							{% if item.code == 'taokeLoginCookie'%}
							<div class="col-md-2">

								<a id="login" class="btn btn-primary  navbar-btn" href="https://login.taobao.com/member/login.jhtml?style=mini&newMini2=true&from=alimama&redirectURL=http://pub.alimama.com/report/getTbkPaymentDetails.json" target="_blank">登录联盟</a>


							</div>
							{% endif %}
							{% if item.code == 'taokeOrderSession'%}
							<div class="col-md-2">

								<a id="login" class="btn btn-primary  navbar-btn" href="https://oauth.taobao.com/authorize?response_type=token&client_id=25552805&state=mrtk&view=web" target="_blank">获取SESSION</a>


							</div>
							{% endif %}
						</div>
						{% endfor %}

					</div>
				</div>
				<div class="col-lg-3"></div>
				<div class="col-lg-6">
					<div class="form-group text-center">
						<label></label>

						<div>
							<button class="btn btn-primary btn-block btn-lg btn-parsley" data-loading-text="正在提交...">提 交</button>
						</div>
					</div>
				</div>
			</form>
		</section>

	</div>
</div>
<script language="JavaScript">
	$(document).ready(function() {

		$('#addForm').ajaxForm({
			dataType: 'json',
			beforeSubmit: function(arr, form, options) {
				form.find("button:submit").button("loading");
			},
			success: function(data, statusText, xhr, form) {
				if(data.errno == 0) {
					Toast.success(data.data);
					setTimeout(function() {
						$("#goback").trigger("click");
					}, 1000);
				} else {
					Toast.error(data.errmsg);
				}
				form.find("button:submit").button("reset");
			}
		});
		

	
	});
</script>
{% endblock %}